from appium.webdriver.common.mobileby import MobileBy

from lagou.appium_exercise4.pages.base_page import BasePage


class AddMemberPage(BasePage):
    manual_add_ele = (MobileBy.XPATH, "//*[@text='手动输入添加']")
    toast_ele = (MobileBy.XPATH, "//*[@class='android.widget.Toast']")
    def manually_add_member(self):
        from lagou.appium_exercise4.pages.edit_member_page import EditMemberPage
        # 点击手动输入添加
        self.find_and_click(*self.manual_add_ele)

        return EditMemberPage(self.driver)

    def get_tip(self):
        # 获取toast 信息
        result = self.find(*self.toast_ele).get_attribute("text")

        return result